package com.phz.springcloud.study.service;

import org.springframework.context.ApplicationListener;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
/**
 * 监听事件
 * @author penghaozhong
 *
 */
@Component
public class UserEventListener implements ApplicationListener<UserEvent> {
    
	@Async
	@Override
    public void onApplicationEvent(UserEvent event) {
		try {
			Thread.sleep(5000);
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
        System.out.println(event.getUser().getName() + " 客户注册了，发送注册邮件-----"+Thread.currentThread().getName());

    }
}
